package com.youhp.spire.xls.demo.Workbook;

import com.spire.xls.*;

public class EncryptWorkbook {
    public static void main(String[] args) {
        String inputFile = "data/EncryptWorkbook.xlsx";
        String outputFile = "output/EncryptWorkbook_out.xlsx";

        //Create a workbook and load a file
        Workbook workbook = new Workbook();
        workbook.loadFromFile(inputFile);

        //Protect the workbook with the password you want
        workbook.protect("eiceblue");

        //Save the Excel file
        workbook.saveToFile(outputFile, ExcelVersion.Version2010);
    }
}
